Repository navigation
feat(spec): type-check packages/spec/src TSDoc examples as a third surface - #11433
Merged
Merged
Conversation
…rface `check:skill-examples` gains a `packages/spec/src/**` surface — the ADR-0033 authoring channel, where a schema's `@example` sits inches from the tombstone written for the same reader and, until now, was compiled by nothing. A new SURFACES entry, not a second extractor: the marker/tsc pipeline was already surface-parameterised and `commentPrefixed` already strips the JSDoc gutter. Compilation stays opt-in; six self-contained blocks are marked. Two things the surface needed: - Surfaces sharing a resolution dir must not share a throwaway build dir — it is wiped when written, so the second would delete the first's blocks. `buildDirName` + `findDuplicateBuildDir()`, pinned both directions. - The marker is a prose line, so `renderFileDescription` emitted it into generated MDX. MDX has no HTML comments, so a marker on a module-level docblock both published an internal annotation to a reference page and broke the docs build. Stripped at prose level during generation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T9cDbY2NBiVJWYx3BpWfH2
Contributor
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 126 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
…s sandbox Adding a third check:skill-examples surface made its per-surface zero-block guard fire on the sandbox's stubbed `packages/spec/src`, ahead of the freshness refusal these cases exist to probe — the same interaction #10969 hit and solved with `seedClientSdkSurface()`. Seeded into the file `srcMtime` already governs, so the surface adds no second ungoverned mtime knob, and the surface count assertion moves 2 -> 3. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T9cDbY2NBiVJWYx3BpWfH2
os-steve
marked this pull request as ready for review
August 23, 2026 19:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10924
check:skill-examplesgains a third surface:packages/spec/src/**TSDoc code blocks.This is the ADR-0033 authoring channel — a schema's
@exampleis what an AI authorcopies, and it sits inches from the tombstone written for that same reader — and until
now nothing compiled it.
check:doc-formula-expressionswalks the same blocks but judgesformula expressions with
@objectstack/formula, never TypeScript.A new
SURFACESentry, not a second extractor, as the card and triage required: themarker/tsc pipeline was already surface-parameterised,
commentPrefixed: truealreadystrips the JSDoc gutter, and
SourceRoot.extwas already kept wide for this. Zero newextraction code.
Why opt-in marking, measured
Of the 146 fenced ts blocks in
packages/spec/src, 128 carry no import of their own —fragments by construction. Of the 18 self-contained ones, both traps in the script's own
header fired on the first run:
ellipsis-placeholder prose —
defineStack({ ... }),SystemObjectName.USER, { ... }—whose TS1109 errors stopped
tscbefore it type-checked anything. The first runreported 15 "clean" blocks that had simply never been checked. Excluding those three and
re-running turned six of the remaining fifteen red on real semantics.
@oclif/core, a relative./realtime-shared.zod, and undefined names (data,engine,SomeSchema) — allfragments, all correctly left unmarked.
A blanket sweep would have misfired on every one of them. The
:93fragment inskill.zod.tsflagged in the parent card (acase 'in':excerpt of the cloud consumer'sswitch) is in the 128 — it carries no import and stays unmarked, as required.
Marked-block census — 6 marked, 140 skipped
ai/skill.zod.ts:249SkillSchema@exampleai/skill.zod.ts:444defineSkill@exampleshared/expression.zod.ts:149cel/F/P)studio/object-designer.zod.ts:40@examplestudio/plugin.zod.ts:37@examplesystem/metadata-form-registry.ts:58@exampleshared/expression.zod.ts:149is a docblock fence not tagged@example— declareddeliberately: it is the same channel (a docblock example a reader copies), it is
self-contained, and it compiles. Everything else is unmarked: 128 no-import fragments,
3 ellipsis fragments, 5 unresolvable fragments, and 4 blocks that are real rot, filed
as #11436 rather than folded, per the triage clause.
Two things the surface needed
1. Surfaces sharing a resolution dir must not share a build dir. Both spec surfaces
resolve against
packages/spec, andwriteBuildDir()wipes its target on entry — so thesecond surface would delete the first's extracted blocks. Sequential execution hides that
today;
--keepwould already retain only the last dir, and a reordered loop would make asurface type-check another's blocks. Added
Surface.buildDirName+findDuplicateBuildDir(), asserted on every run and pinned in both directions in theself-test (a guard that can only ever return null is indistinguishable from a correct
config).
2. The marker leaked into generated reference pages. The marker sits above the
fence, so it is a prose line, and
renderFileDescriptionemits prose verbatim — landingos:checkincontent/docs/references/studio/object-designer.mdxand.../plugin.mdx,the two spec modules whose marked examples live in the module block rather than on a
declaration. MDX has no HTML comments (fumadocs-mdx fails the build outright), so this
would have both published an internal annotation to a customer-facing page and broken the
docs build. The MDX wrapper spelling cannot be used in a
.tsdocblock — it ends in thetwo characters that terminate a block comment — so the fix is to strip the marker during
generation, at prose level only: the same text inside a fence is an author
illustrating the convention, and is content. Pinned both ways in
file-description.test.ts. After the strip the generated tree is byte-identical tomain— this PR touches no file undercontent/docs/, andcheck:generatedreportsall 14 artifacts up to date.
Second commit: adding a third surface made its per-surface zero-block guard fire on the
dist-freshness-adoptionsandbox's stubbedpackages/spec/src, ahead of the freshnessrefusal those cases probe — the same interaction #10969 hit and solved with
seedClientSdkSurface(). Seeded into the filesrcMtimealready governs, so no secondungoverned mtime knob; the surface-count assertion moves 2 → 3.
Reverse verification — predicted RED, observed RED
Reintroducing
triggerPhrases(aretiredKey()in that same file) into a marked block:Gate exit 1, and
:255is exactly the injected line — the block-line → source-lineremapping is correct. Both legs ran under a restore
trapand proved themselves on diskrather than trusting an editor's exit code: mutation leg
INJECTED_TEXT_COUNT=1+ presentin 2 built
.d.tsfiles; restore leg count0,--absentover 209 built files, gate backto exit 0. Both legs rebuilt
packages/spec— editingsrc/makesdiststale, andthe gate's freshness guard would otherwise refuse with a message that is neither a pass nor
a real red.
This confirms the sibling card's finding that compile-only is sufficient for this class:
a retired key surfaces as
undefinedinz.input, so passing it is a type error, norunner involved.
Verification (all at final commit
e9c40a11fc, tree clean vs HEAD)check:skill-examples— exit 0,253 prose examples type-check across 3 surface(s)(skills+docs 228 · spec source 6 · client SDK 19)
check:generated— exit 0,All 14 generated artifacts are up to datepnpm --filter @objectstack/spec test— exit 0,419 passed (419)/11148 passed (11148)pnpm --filter @objectstack/spec exec tsc --noEmit— exit 0dispatch-gates.mjs --repo(no pathspassed) — 26 pass / 0 fail, re-run at the final head
check:type-check-coverage— exit 0Changeset
patchfor@objectstack/spec, measured not assumed: the marker lands in the publisheddist/skill.zod-*.d.ts(2 occurrences) and spec'sfilesalso publishessrc/**/*.zod.ts, so it is consumer-visible text. Same precedent as the sibling card, andthe same inert-comment trade-off already accepted for the 228 markers shipping in
skills/. Notskip-changeset— this PR publishes bytes.Out of scope, filed not folded
packages/spec/srcTSDoc examples do not compile — the rootindex.tsteaches an@objectstack/spec/authsubpath that does not exist #11436 — four self-contained spec examples that do not compile. The headline one is theroot
index.ts, whose three documented import styles all name an@objectstack/spec/authsubpath the package does not export.packages/client-react/.examples-build/is not gitignored — check:skill-examples' second surface writes an untracked throwaway dir #11440 —packages/client-react/.examples-build/has never been gitignored (pre-existingfrom [finding] No gate type-checks TSDoc
@exampleblocks inpackages/client-react(orpackages/client*) — the SDK's own docs rotted unobserved #10969; this PR adds the entry only for the dir it introduces).#11355 interaction — not touched
The open finding on the extraction loop's fence-awareness is not required by this
surface and is not fixed here. The new root needs no nested-fence extraction, and the
marked-block census is closed, so no block reaches
tscthrough that path. Noted ratherthan folded, per dispatch.
Generated by Claude Code